package com.jec.module.sysconfig.service.configor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Component;

import com.jec.module.sysconfig.dao.DigitTrunkRepository;
import com.jec.module.sysconfig.entity.DigitTrunk;
import com.jec.module.sysconfig.service.convertor.Convertor;
import com.jec.module.sysconfig.service.convertor.DigitTrunkConvertor;

@Component
public class DigitTrunkConfigor extends BaseConfigor<DigitTrunk> {
	
	@Autowired
	private DigitTrunkRepository digitTrunkRepository;
	
	@Autowired 
	private DigitTrunkConvertor digitTrunkConvertor;	
	
	public DigitTrunkConfigor() {
		logKey = "数字中继";
	}

	@Override
	protected JpaRepository<DigitTrunk, Integer> getRepository() {
		return digitTrunkRepository;
	}

	@Override
	protected Convertor<DigitTrunk> getConvertor() {
		return digitTrunkConvertor;
	}

	@Override
	public boolean hasConfigOnNetunit(int netunit) {
		return !digitTrunkRepository.findAllByNetunit(netunit).isEmpty();
	}
}
